
from bcat.rpc.server.impl.flask_server import FlaskServer
from bcat.rpc.app.common_server_application import CommonServerApplication

def start_jsonrpcserver(url, name):
    from bcat.rpc.server.impl.jsonrpcserver.service_wrapper import CommonServiceWrapper
    from bcat.rpc.server.impl.jsonrpcserver.flask_server_wrapper import FlaskServerWrapper
    CommonServerApplication(CommonServiceWrapper(), \
            FlaskServerWrapper(FlaskServer(url, name))
        ) \
        .run()

def start_jsonrpc(url, name):
    from bcat.rpc.server.impl.json_rpc.flask_server_wrapper import FlaskServerWrapper as JsonRpcFlaskServerWrapper
    from bcat.rpc.server.services.common_service import CommonService
    CommonServerApplication(CommonService(), \
            JsonRpcFlaskServerWrapper(FlaskServer(url, name))
        ).run()

url = "http://127.0.0.1:5000"
name = "FlaskJsonRpcServer"
#start_jsonrpcserver(url, name)
start_jsonrpc(url, name)
